package cm

import (
	v1 "k8s.io/api/core/v1"
	"time"
)

type ReqBase struct {
	Name      string `json:"name" form:"name"`
	Namespace string `json:"namespace" form:"namespace"`
}
type GetReq struct {
	ReqBase `json:",inline"`
}

type GetResp struct {
	Cm *v1.ConfigMap `json:"cm"`
}

type CreateReq struct {
	ReqBase `json:",inline"`
	Data    map[string]string `json:"data"`
}

type CreateResp struct {
	Name string        `json:"name"`
	IsOk bool          `json:"is_ok"`
	Cm   *v1.ConfigMap `json:"info"`
}

type UpdateReq struct {
	ReqBase `json:",inline"`
	Data    map[string]string `json:"data"`
}

type UpdateResp struct {
	Cm *v1.ConfigMap `json:"cm"`
}

type DeleteReq struct {
	ReqBase `json:",inline"`
}

type ListReq struct {
	ReqBase `json:",inline"`
}

type ListResp struct {
	Total int64        `json:"total"`
	Items []*ConfigMap `json:"items"`
}

type ConfigMap struct {
	DeployName string        `json:"conf_name" bson:"conf_name"`
	Namespace  string        `json:"namespace" bson:"namespace"`
	CreateTime time.Time     `json:"create_time" bson:"create_time"`
	Cm         *v1.ConfigMap `json:"cm" bson:"cm"`
}
